<template>
  <div>
    <el-table ref="table" v-loading="loading" :data="list" style="width: 100%" border>
      <el-table-column width="50" label="序号" key="1" header-align="center" align="center">
        <template slot-scope="scope">
          <div>{{$parent.params.per_limit*($parent.params.page-1)+scope.$index+1}}</div>
        </template>
      </el-table-column>
      <el-table-column header-align="center" align="center" prop="id" label="ID" key="2" width="50"></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="apply_no"
        key="3"
        show-overflow-tooltip
        label="申请单号"
        width="220"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="4"
        prop="merchant_no"
        show-overflow-tooltip
        label="商户编号"
        width="130"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="5"
        prop="agent_info"
        label="代理信息"
        show-overflow-tooltip
        width="120"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="6"
        prop="sign_name"
        label="签约名"
        show-overflow-tooltip
        width="130"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="7"
        prop="merchant_name"
        show-overflow-tooltip
        label="展示名"
        width="80"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="8"
        prop="merchant_type_name"
        label="商户类型"
        width="90"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        prop="lp_name"
        key="9"
        label="法人"
        show-overflow-tooltip
        width="90"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="10"
        prop="address_info"
        show-overflow-tooltip
        label="所在地址"
        width="120"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="11"
        prop="account_type_name"
        label="结算类型"
        width="90"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="12"
        prop="holder_name"
        show-overflow-tooltip
        label="开户人"
        width="80"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="13"
        prop="card_info"
        label="结算卡信息"
        show-overflow-tooltip
        width="100"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="14"
        prop="fail_reason"
        show-overflow-tooltip
        v-if="status===2||status===''"
        label="失败原因"
        width="100"
      ></el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        key="15"
        prop="created_at"
        label="提交时间"
        width="140"
      ></el-table-column>
      <el-table-column
        v-if="status!==0"
        header-align="center"
        align="center"
        key="16"
        prop="audited_at"
        label="审核时间"
        width="140"
      ></el-table-column>
      <el-table-column
        v-if="status!==1"
        header-align="center"
        key="18"
        align="center"
        fixed="right"
        label="操作"
        width="auto"
        min-width="145"
      >
        <template slot-scope="scope">
          <div v-if="status!==1">
            <el-button
              v-if="searchInterface('merchant_applies.audit')"
              @click="toExamine(scope.row)"
              type="text"
            >{{scope.row.status==2?'重新审核':'审核'}}</el-button>
            <el-button @click="seeDetail(scope.row)" type="text">查看详情</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <examineDialog ref="dialog" :ID="id" />
  </div>
</template>

<script>
// 等待审核
import examineDialog from '../dialog'
import imgTemplate from '@/components/img-template/img-template'
export default {
  components: {
    examineDialog,
    imgTemplate
  },
  props: {
    list: {
      type: Array,
      required: true
    },
    loading: {
      type: Boolean,
      required: true
    },
    callback: {
      type: Function,
      required: true
    },
    status: {
      type: [Number, String],
      required: true
    }
  },
  data() {
    return {
      id: 0
    }
  },
  watch: {
    list() {
      setTimeout(() => {
        this.$refs.table.doLayout()
      })
    }
  },
  methods: {
    // 审核
    toExamine({ id }) {
      this.id = id
      this.$refs['dialog'].openDialog()
    },
    // 查看详情
    seeDetail({ id }) {
      this.$router.push({
        path: '/menu/merchant-examine/examine-detail',
        query: { id }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>